/*  This file is part of the comicconquer project
    Copyright (C) 2010 Reach <reach334@gmail.com>

    ComicConquer is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public 
    License along with this software.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef CONUMBEREDITOR_H
#define CONUMBEREDITOR_H

#include "mist.h"
#include "onyx/ui/buttons.h"
#include "onyx/ui/label.h"

/**
 * The number editor composed of an OnyxLabel and an OnyxPushButton.
 * 
 * @author reach (5/25/2010)
 */
class CoNumberEditor : public QWidget
{
    Q_OBJECT

    //-- constructor
public:
    CoNumberEditor(const QString& text, const QString& unit, float max, float rate = 1.0f, QWidget* parent = 0);

    //-- signals
    signals:
    void updateRequest();

    //-- publish methods
public:
    void setValue(float value);
    float getValue();
    void districtOther(QWidget* widget, bool inverse = false);

    //-- private slots
private slots:
    void inputNumber();

    //-- private members
private:
    ui::OnyxLabel m_label;
    ui::OnyxPushButton m_editor;
    QHBoxLayout m_layout;
    QString m_unit;
    float m_rate;
    float m_max;
    float m_value;
};

#endif // COEDITOR_H
